package logic

import (
	"context"
	"home-manage/homerpc/homerpc"
	"home-manage/homerpc/internal/svc"
	"home-manage/model"

	"github.com/zeromicro/go-zero/core/logx"
)

type ConsultationShowLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewConsultationShowLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ConsultationShowLogic {
	return &ConsultationShowLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

func (l *ConsultationShowLogic) ConsultationShow(in *homerpc.ConsultationShowRequest) (*homerpc.ConsultationShowResponse, error) {
	// todo: add your logic here and delete this line

	var counsulation model.Consultation
	model.DB.Debug().Where("id=?", in.ConsultationId).Find(&counsulation)
	return &homerpc.ConsultationShowResponse{
		UserId:  int64(counsulation.UserId),
		HouseId: int64(counsulation.HouseId),
		Content: counsulation.Content,
	}, nil
}
